<?php
/**
 * @Author: xuzhiyi
 * @Date:   2016-02-16 20:57:19
 * @Last Modified by:   xuzhiyi
 * @Last Modified time: 2016-02-27 11:51:44
 * ------------------------------------------------ *
 * 导航管理                                         *
 * ------------------------------------------------ */

namespace Admin\Controller;
class NavsController extends CommonController {

	public function index(){
		if(IS_AJAX){
			switch(I('ajax')){
				case "isShow":
					$status = D('Navs')->isShow();
					$this->ajaxReturn($status);
					break;
				case "isOpen":
					$status = D('Navs')->isOpen();
					$this->ajaxReturn($status);
					break;
				case "addNavs":
					$a = D('Navs')->addNavs();
					if($a){
						$this->success('导航添加成功！','',true);	
					}
					$this->error('导航添加失败！','',true);
					break;
				case "delNavs":
					$status = D('Navs')->delNavs();
					$this->ajaxReturn($status);
					break;
				case "editNavs":
					$a = D('Navs')->editNavs();
					if($a){
						$this->success('导航修改成功！','',true);	
					}
					$this->error('导航修改失败！','',true);
					break;
				default:
			 		$result = M('Navs')->select();
			 		$output['data'] = $result;
			 		$this->ajaxReturn($output);
			}
		}
		$this->display();
	}

}